Page({
  data: {
    select: false,
    animationData: {},
    totalnum: 1,
    num: 0,
    tocar: false,
    imgUrls: [
      '/images/b1.jpg',
      '/images/b2.jpg',
      '/images/b3.jpg'
    ],
    src: '/images/c2.png',
    indicatorDots: false,
    autoplay: false,
    interval: 3000,
    duration: 800,
    
  },
  changeIndicatorDots: function (e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeAutoplay: function (e) {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },
  intervalChange: function (e) {
    this.setData({
      interval: e.detail.value
    })
  },
  durationChange: function (e) {
    this.setData({
      duration: e.detail.value
    })
  },

  // 显示遮罩层
  showselect: function (e) {
   
    this.setData({
      select: true
    })
    
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
    })

    this.animation = animation
    animation.translateY(-300).step()

    this.setData({
      animationData: animation.export()
    })
  },

  // 隐藏遮罩层
  hiddenselect: function (e) {
    
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
    })

    this.animation = animation

    animation.translateY(300).step()

    this.setData({
      animationData: animation.export()
    })

    setTimeout(function () {
      this.setData({
        select: false
      })
    }.bind(this), 500)
    
    

  },

  // 加入购物车
  addToCart() {
    const self = this;
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
    })

  },


})